Skip to content

Conversation

@resistor
Copy link
Collaborator

  • [RISCV] Use common code for R_RISCV_CHERI_CAPABILITY in getRelocType
  • [NFC][Target][AsmPrinter] Introduce and use lowerCheriCodeReference
  • [BinaryFormat][RISCV] Reserve R_RISCV_CHERI_CAPABILITY_CODE
  • [RISCV] Add MC support for .chericap %code(expr)
  • [ELF][RISCV] Support R_RISCV_CHERI_CAPABILITY_CODE and R_RISCV_FUNC_RELATIVE
  • [RISCV] Use new %code(expr) for lowerCheriCodeReference
  • [ELF][RISCV] Handle R_RISCV_FUNC_RELATIVE in getImplicitAddend

jrtc27 and others added 7 commits November 13, 2025 10:03
Currently it's a one-liner but more code will be added here, so avoid
needing to duplicate it.
This will allow targets to create a target-specific MCExpr for referring
to code, bypassing any use of trampolines in the presence of a c18n
runtime.
For non-c18n runtimes this is the same as R_RISCV_CHERI_CAPABILITY, but
for c18n runtimes this marks capabilities that must not be wrapped in a
trampoline as they must point directly to the code in question.
…ELATIVE

Note that we only use R_RISCV_FUNC_RELATIVE for CheriABI binaries as
it's redundant for plain RISC-V and we would not be able to produce
binaries that work with existing upstream RISC-V runtimes.
Otherwise linking with --apply-dynamic-relocs (as is done by U-Boot, or
due to -z rel which we don't support) when --check-dynamic-relocs is
enabled (which is the default in assertions builds) will give an
internal linker error when such a relocation is emitted.

Fixes: 2d52aa8 ("[ELF][RISCV] Support R_RISCV_CHERI_CAPABILITY_CODE and R_RISCV_FUNC_RELATIVE")
@resistor resistor merged commit f17670e into CHERIoT-Platform:cheriot Nov 14, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants